# -*- coding: utf-8 -*-
#  @author  Bink
#  @date  2020/9/30 16:27
# @Email : 2641032316@qq.com

with open("./study/python/1001/bink.txt", "r", encoding="utf-8") as file:
    lines = [str(index) + "." + line.rstrip() + '\n' for index, line in enumerate(file.readlines(), start=1)]
    with open('SeqAddedFiletxt', 'w', encoding='utf-8') as f:
        f.writelines(lines)

# TODO 模拟写日记、读日记、退出
with open("./diary.txt", 'w+', encoding='utf8') as file:
    input_no = input('请键入选项：1、2(非数字退出):\t')
    while input_no.isdigit() and int(input_no) in (1, 2):
        input_no = int(input_no)
        if input_no == 1:
            file.write(input('写日记:')+'\n')
        elif input_no == 2:
            file.seek(0, 0)
            print("读出内容如下：")
            for line in file.readlines():
                print(line, end='')
        input_no = input('请键入选项：:\t')
    else:
        print('程序已退出...')
